<template>
  <div>
<h2>修改页面</h2>
<table>
  <tr>
    <td>投资名称</td>
    <td><input type="text" v-model="showData.name"></td>
  </tr>
  <tr>
    <td>投资总金额</td>
    <td><input type="text" v-model="showData.total"></td>
  </tr>
  <tr>
    <td></td>
    <td><input type="button" value="修改" @click="upt"></td>
  </tr>
</table>
  </div>
</template>

<script setup lang="ts">

import {reactive,toRefs} from 'vue'
import {useRoute} from 'vue-router'
import axios from 'axios'
const route = useRoute()

import {useRouter} from 'vue-router'
const router = useRouter()

let data:any=reactive({
  showData:{
    name:'',
    total:'',
    Iid:route.query.Iid
  }
})

let {showData} =toRefs(data)

const upt=()=>{
  axios({
    url:'http://localhost:50805/api/Invest/PostUptInvest',
    method:'post',
    data:showData.value
  }).then(res=>{
    console.log(res)
    if(res.data.data>0){
      alert("修改成功")
      router.push('/invest')
    }else{
      alert("修改失败")
      router.push('/invest')
    }
  }).catch(err=>{
    console.log(err)
    alert("修改失败")
    router.push('/invest')
  })
}

</script>

<style scoped>

</style>